package com.example.jobdemo.controller;

import com.example.jobdemo.entity.UserCollect;
import com.example.jobdemo.entity.UserComment;
import com.example.jobdemo.mapper.UserCollectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("collect")
public class CollectController {

    @Autowired
    private UserCollectMapper userCollectMapper;

    @RequestMapping("insert")
    public Map<String, Object> insert(@RequestBody UserCollect collect) {
        userCollectMapper.insertSelective(collect);
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "成功");
        return map;
    }

    @RequestMapping("delete")
    public Map<String, Object> delete(@RequestBody UserCollect collect) {
        userCollectMapper.deleteByPrimaryKey(collect.getUserCollectId());
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "成功");
        return map;
    }
}
